from flask import Flask
from flask import Flask
import flask
from flask.config import Config
from flask.json import jsonify
from flask.wrappers import Request
from flask_cors import CORS
from werkzeug.wrappers import request
from config import Config
from db import Db
import json

app=Flask('__name__')
app.config.from_object(Config)
@app.route('/shop')
def method_name():
    #获取用户
    data=Request.data
    name=data['name']
    price=data['price']
    sql="insert into news(name,price) values('%s')"%(name,price)
    try:
        Db.insert(sql)
        return jsonify({'code':200})
    except:
        return jsonify({'code':10010})


    #构造spl语句




if __name__=='__main__':
    app.run


